package com.dmooo.yxmmerchant.adapter;

import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.dmooo.yxmmerchant.R;
import com.dmooo.yxmmerchant.domain.PartialListBean;

import java.util.List;

public class PartialListAdapter extends BaseQuickAdapter<PartialListBean.Item,BaseViewHolder> {
    public PartialListAdapter(int layoutResId, @Nullable List<PartialListBean.Item> data) {
        super(layoutResId, data);
    }
    @Override
    protected void convert(BaseViewHolder helper, PartialListBean.Item item) {
        helper.setText(R.id.txt_name,"第"+(helper.getAdapterPosition()+1)+"阶段支付"+Double.valueOf(item.money)*100+"%");
        helper.setText(R.id.txt_status,"1".equals(item.status)?"未支付":"已支付");
        TextView h=helper.getView(R.id.txt_status);
        if("1".equals(item.status)){
            h.setTextColor(mContext.getResources().getColor(R.color.darkgray));
        }else{
            h.setTextColor(mContext.getResources().getColor(R.color.colorPrimary));
        }
        helper.setText(R.id.txt_time,item.day+"天后支付下一阶段");
        if(helper.getAdapterPosition()==mData.size()-1){
            helper.setText(R.id.txt_time,"支付完成");

        }
    }
}
